package sk.openit.hibernate.entities;

// Generated 17.8.2011 17:02:48 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Employee generated by hbm2java
 */
@Entity
@Table(name = "Employee", catalog = "skolenie")
public class Employee implements java.io.Serializable {

	private int id;
	private Person person;
	private Manager manager;
	private String company;
	private Double salary;
	private Set projects = new HashSet(0);
	private Set managers = new HashSet(0);

	public Employee() {
	}

	public Employee(int id) {
		this.id = id;
	}

	public Employee(int id, Person person, Manager manager, String company,
			Double salary, Set projects, Set managers) {
		this.id = id;
		this.person = person;
		this.manager = manager;
		this.company = company;
		this.salary = salary;
		this.projects = projects;
		this.managers = managers;
	}

	@Id
	@Column(name = "ID", unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PersonID")
	public Person getPerson() {
		return this.person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ManagerID")
	public Manager getManager() {
		return this.manager;
	}

	public void setManager(Manager manager) {
		this.manager = manager;
	}

	@Column(name = "Company", length = 100)
	public String getCompany() {
		return this.company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	@Column(name = "Salary", precision = 53, scale = 0)
	public Double getSalary() {
		return this.salary;
	}

	public void setSalary(Double salary) {
		this.salary = salary;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "ProjectEmployees", catalog = "skolenie", joinColumns = { @JoinColumn(name = "EmployeeID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "ProjectID", nullable = false, updatable = false) })
	public Set<Project> getProjects() {
		return this.projects;
	}

	public void setProjects(Set projects) {
		this.projects = projects;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "employee")
	public Set<Manager> getManagers() {
		return this.managers;
	}

	public void setManagers(Set managers) {
		this.managers = managers;
	}

}
